package cn.itcast.nems.studentrecord.constant;

import lombok.Getter;

import java.util.Objects;

/**
 * <p>
 * 订单类型枚举
 * </p>
 *
 * @author zhouwei
 * @since 2023/9/11 10:39 PM
 **/
@Getter
public enum ContractStateEnum {
    // 合同签订状态;枚举值：未签订｜UNSIGNED、已签订｜SIGNED、待重签｜RESIGNING、已重签｜RESIGNED
    SKIPED("无需签订"), UNSIGNED("未签订"), SIGNED("已签订"), RESIGNING("待重签"), RESIGNED("已重签"),CANCELED("已作废");
    private final String name;

    ContractStateEnum(String name) {
        this.name = name;
    }

    public static ContractStateEnum convertContractStateEnum(Integer contractState) {
        if (Objects.isNull(contractState)) {
            return ContractStateEnum.UNSIGNED;
        }
        switch (contractState) {
            case 1 -> {
                return ContractStateEnum.SIGNED;
            }
            case 3 -> {
                return ContractStateEnum.CANCELED;
            }
            default -> {
                return ContractStateEnum.UNSIGNED;
            }
        }
    }
}
